import { EMAIL, PHONE, URL } from "@/utils/regEx";

/**
 * 手机
 * @param {string} mobile
 * @returns {Boolean}
 */

export function validMobile(mobile) {
    const reg = PHONE;
    return reg.test(mobile);
}

/**
 * 邮箱
 * @param {string} email
 * @returns {Boolean}
 */
export function validEmail(email) {
    const reg = EMAIL;
    return reg.test(email);
}

/**
 * 路径
 * @param {string} url
 * @returns {Boolean}
 */
export function validURL(url) {
    const reg = URL;
    return reg.test(url);
}

/**
 * 字符串
 * @param {string} str
 * @returns {Boolean}
 */
export function isString(str) {
    if (typeof str === "string" || str instanceof String) {
        return true;
    }
    return false;
}